<?php
namespace app\mobile\model;

/**
 * Class MemberDistribution
 * @package app\mobile\model      分销列表表
 */
class MemberDistribution extends BaseModel
{
    //分销列表下线人和分销订单一对多
    public function memberDistributionOrder()
    {
        return $this->hasMany('MemberDistributionOrder','member_id','referrals_id');
    }
    //分销列表和会员表一对一  (分销人)
    public function member()
    {
        return $this->belongsTo('Member','referrals_id','id');
    }
    //分销列表和会员多对一  (推荐人)
    public function TjMember()
    {
        return $this->belongsTo('Member','distribution_id','id')->field('id,nickname');
    }

    public function getCreateTimeAttr($value)
    {
        return date('Y-m-d',$value);
    }
}